#ifndef GLWIDGET_H
#define GLWIDGET_H

#include <QGLWidget>
#include <QTimer>
#include <QTime>

const unsigned int GRID_SIZE(45);

class GLWidget : public QGLWidget
{
  Q_OBJECT

public:
  GLWidget(QWidget* parent = 0, unsigned int fps = 30);
  virtual ~GLWidget();

protected:
  virtual void initializeGL();
  virtual void resizeGL(int w, int h);
  virtual void paintGL();
  virtual void keyPressEvent(QKeyEvent *e);

  void loadGLTexture(const QString& filename, GLuint textures[3]);

signals:
  void fps(unsigned int);

private:
  QTimer mTimer;
  QTime mTime;
  unsigned int mFramesPainted;

  GLuint mTextures[1];

  double mGrid[GRID_SIZE][GRID_SIZE][3];
  double mXRot;
  double mYRot;
  double mZRot;
};

#endif
